<?php
 
include_once dirname(__FILE__) . '/PHPMailer/class.phpmailer.php';
include_once dirname(__FILE__) . '/definitions.php';
 
class ForumMailer extends PHPMailer
{
	public function MailImplementsAndSend($to, $subject, $title, $body)
	{
		$this->From = FROM_MAIL; 
		$this->FromName = FROM_NAME; 
		$this->Subject = $subject; 
		$this->AltBody = ALT_MESSAGE;
		$this->Sender = ADMIN_EMAIL;
		$this->AddAddress($to);
 
		$message = '<html><head><style>';
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/css/mail.css');
		$message .= '</style></head><body>';
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/mailer_header.php');
		$message .= '<h1>' . $title . '</h1>';
		$message .= $body;
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/mailer_footer.php');
		$message .= '</body></html>';
 
		$this->MsgHTML($message);
		$this->Send();
		$this->ClearAllRecipients();
	}
	public function MailImplementsAndSendFromAdmin($to, $subject, $title, $body)
	{
		$this->From = FROM_MAIL; 
		$this->FromName = FROM_NAME; 
		$this->Subject = $subject; 
		$this->AltBody = ALT_MESSAGE;
		$this->Sender = ADMIN_EMAIL;
		$this->AddAddress($to);
 
		$message = '<html><head><style>';
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/css/mail.css');
		$message .= '</style></head><body>';
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/mailer_header.php');
		$message .= '<h1>' . $title . '</h1>';
		$message .= $body;
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/mailer_footer.php');
		$message .= '</body></html>';
		
		$this->MsgHTML($message);
		$this->Send();
		$this->ClearAllRecipients();
	}
	public function IscrizioniMailImplementsAndSend($to, $subject, $title, $body)
	{
		$this->From = FROM_MAIL; 
		$this->FromName = FROM_NAME; 
		$this->Subject = $subject; 
		$this->AltBody = ALT_MESSAGE;
		$this->Sender = ADMIN_EMAIL;
		$this->AddAddress($to);
 
		$message = '<html><head><style>
		';
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/css/mail.css');
		$message .= '</style></head><body>';
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/mailer_header.php');
		$message .= '<h1>' . $title . '</h1>';
		$message .= $body;
		$message .= file_get_contents(SYSTEM_URL.'template/' . TEMPLATE_NAME . '/mailer_footer.php');
		$message .= '</body></html>';
 
		$this->MsgHTML($message);
		$this->Send();
		$this->ClearAllRecipients();
	}
}
 
?>